<?php
use app\common\helper\setting_helper;
use app\common\helper\company_helper;
?>
{include file="../app/common/admin/lib/header.html" title="公众号管理"}
{if $card_list}
<div class="page-header border-bottom clearfix">
  <h2 class="left">公众号管理<span>在这里对公众号进行管理</span></h2>
  <a href="{:url('open_card/admin/add')}" class="btn btn-success btn-sm right js_addCard"><i class="icon-add"></i>添加公众号</a>
</div>
<!--{/*<div class="alert">-->
    <!--<strong>温馨提示</strong>：您还有{$company_remain}个微信公众号配额，请珍惜使用-->
<!--</div>*/}-->
 <ul class="account-list clearfix js_cardListBox" data-total="{:company_helper::get_company_level_total($company_id)}">
  {foreach $card_list as $k=>$v}
   <li id="dataList{$v.id}" data-id={$v.id} class="js_preCard">
     <div class="item clearfix">
       <div class="account-photo left">
        <a href="{$v.card_link}">
          {if $v.cover}
          <img src="{:_image($v.cover, 'small')}" width="138" height="130">
          {else}
          <img src="{$Think.const.SITE_URL}/static/images/m/default/article_default.jpg" width="138" height="130">
          {/if}
        </a>
      </div>
       <div class="account-intro right">
         <h4>公众号：<a href="{$v.card_link}">{$v.title}</a></h4>
         <p>二级域名: {$v.domain}</p>
         <p>创建日期: {$v.add_time|time_format}</p>
         <div>
           <a href="{$v.card_link}" class="btn btn-success btn-xs">管理</a>
           <a href="{:url("/open_card/admin/edit",["id" => $v.id])}" class="btn btn-info btn-xs">编辑</a>
           <!--{*<a href="javascript:void(0);" class="btn btn-danger btn-xs js_deleteOne">删除</a>*}-->
         </div>
       </div>
     </div>
   </li>
   {/foreach}
 </ul>
{/if}
<div class="search-none {if $card_list}hidden{/if} js_emptyTip">
  <p>还没有添加公众号，点击&nbsp;&nbsp;&nbsp;<a href="{:url('/open_card/admin/add')}" class="btn btn-success btn-sm js_addCard"><i class="icon-add"></i>添加公众号</a></p>
</div>
<!--end:列表-->
<script>
$(function(){
  $(".js_deleteOne").click(function(){
    var thisObj = $(this);
    var currId = thisObj.closest('.js_preCard').attr('data-id');
    
    showConfirm('您确定要删除该公众号吗?', 1, function(){
      $.post(siteUrl+'/open_card/admin/delete', { 'id':currId }, function(json){
        if (json.info != 'ok') {
          showMsg(json.info);
          return false;
        }
        
        thisObj.closest('.js_preCard').remove();
        if ($(".js_preCard").length < $(".js_cardListBox").attr('data-total')) {
          $(".js_addCard").show();
        }
        if ($(".js_preCard").length == 0) {
          $(".js_addCard").hide();
          $(".js_emptyTip").show();
          $(".js_cardListBox").hide();
          $(".page-header").hide();
        }
      }, 'json');
    });
  });
});
</script>
{include file="../app/common/admin/lib/footer.html"}